package com.ucar.train.service.xumingzhi.ResultUtil;
/**
 * Desciption:
 *
 * @Author: XuMingZhi.
 * Creation time: 2019/8/22 8:36:00.
 * © Copyright 2013-2019, UCar.
 */
public class ResultUtil {

    /**成功且带数据**/
    public static Result SUCCESS(Object object){
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(object);
        return result;
    }
    /**成功但不带数据**/
    public static Result SUCCESS(){

        return SUCCESS(null);
    }
    /**失败且带数据**/
    public static Result BADREQUEST(Object object){
        Result result = new Result();
        result.setCode(ResultEnum.BAD_REQUEST.getCode());
        result.setMsg(ResultEnum.BAD_REQUEST.getMsg());
        result.setData(object);
        return result;
    }
    /**失败但不带数据**/
    public static Result BADREQUEST(){

        return BADREQUEST(null);
    }

    /**失败且带数据**/
    public static Result GONE(Object object){
        Result result = new Result();
        result.setCode(ResultEnum.GONE.getCode());
        result.setMsg(ResultEnum.GONE.getMsg());
        result.setData(object);
        return result;
    }
    /**失败但不带数据**/
    public static Result GONE(){

        return GONE(null);
    }

    /**超时且带数据**/
    public static Result TIMEOUT(Object object){
        Result result = new Result();
        result.setCode(ResultEnum.REQUEST_TIMEOUT.getCode());
        result.setMsg(ResultEnum.REQUEST_TIMEOUT.getMsg());
        result.setData(object);
        return result;
    }
    /**超时但不带数据**/
    public static Result TIMEOUT(){

        return TIMEOUT(null);
    }

    /**超时且带数据**/
    public static Result BADGATEWAY(Object object){
        Result result = new Result();
        result.setCode(ResultEnum.BAD_GATEWAY.getCode());
        result.setMsg(ResultEnum.BAD_GATEWAY.getMsg());
        result.setData(object);
        return result;
    }
    /**超时但不带数据**/
    public static Result BADGATEWAY(){

        return BADGATEWAY(null);
    }
}